<template>
  <div class="box_per">
    <!--<div class="tites">-->
    <!--<div>-->
    <!--<img src="../../assets/images/18关于-下拉框_03.gif" alt="" />-->
    <!--<span>AQBMTJ</span>-->
    <!--</div>-->
    <!--</div>-->
    <div class="box_title">

      <div class="boot_left">

        <div class="boot_goods">
          <span>欢迎使用</span>
          <span>{{systemName}}</span>
        </div>
        <!--<div class="bot_botgos">-->
        <!--<div class="uls">-->
        <!--<li class="todi">-->
        <!--<div class="tupi">-->
        <!--<img src="../../assets/images/18关于-下拉框_07.gif" alt="" />-->
        <!--</div>-->
        <!--<div class="weniz">-->
        <!--<span>所属单位</span>-->
        <!--<span>北京xxx软件股份有限公司</span>-->
        <!--</div>-->
        <!--</li>-->
        <!--<li style="margin-right: 0px">-->
        <!--<div class="tupi">-->
        <!--<img src="../../assets/images/18关于-下拉框_09.gif" alt="" />-->
        <!--</div>-->
        <!--<div class="weniz">-->
        <!--<span>责任人</span>-->
        <!--<span>王一明</span>-->
        <!--</div>-->
        <!--</li>-->
        <!--<li>-->
        <!--<div class="tupi">-->
        <!--<img src="../../assets/images/18关于-下拉框_13.gif" alt="" />-->
        <!--</div>-->
        <!--<div class="weniz">-->
        <!--<span>资产秘密</span>-->
        <!--<span>秘密</span>-->
        <!--</div>-->
        <!--</li>-->
        <!--<li>-->
        <!--<div class="tupi">-->
        <!--<img src="../../assets/images/18关于-下拉框_15.gif" alt="" />-->
        <!--</div>-->
        <!--<div class="weniz">-->
        <!--<span>硬件平台</span>-->
        <!--<span>申威831</span>-->
        <!--</div>-->
        <!--</li>-->
        <!--<li>-->
        <!--<div class="tupi">-->
        <!--<img src="../../assets/images/18关于-下拉框_17.gif" alt="" />-->
        <!--</div>-->
        <!--<div class="weniz">-->
        <!--<span>操作系统</span>-->
        <!--<span>银河麒麟</span>-->
        <!--</div>-->
        <!--</li>-->
        <!--</div>-->
        <!--</div>-->
      </div>
      <!-- <div class="boot_right"></div> -->
    </div>
    <div class="box_totfot">
      <div class="box_card">
        <el-row class="lists" v-for=" item in menuDatas">
          <!-- <el-col :span="4" :offset="2">
            <li @click="sanheyis" style=" ">
              <span><img src="../../assets/redlogo/zichan.png" class="imgStyle" alt="" /></span>
              <span>资产管理</span>
            </li>
          </el-col> -->
          <el-col class="cards" :span="4" :offset="2" style="cursor:pointer;">
            <li @click="goto(item.path)" class="lists_card">
              <span><img :src="item.imgUrl" class="imgStyle" alt="" /></span>
              <span class="text">{{item.name}}</span>
            </li>
          </el-col>
          <!-- <el-col :span="4" :offset="2">
            <li @click="shenjirzs" style=" ">
              <span><img src="../../assets/redlogo/rizhi.png" class="imgStyle" alt="" /></span>
              <span>审计日志</span>
            </li>
          </el-col>
          <el-col :span="4" :offset="2">
            <li @click="jierukong" style=" ">
              <span><img src="../../assets/redlogo/celue.png" class="imgStyle" alt="" /></span>
              <span>策略管理</span>
            </li>
          </el-col>
          <el-col :span="4" :offset="2">
            <li @click="setting" style=" ">
              <span><img src="../../assets/redlogo/shezhi.png" class="imgStyle" alt="" /></span>
              <span>系统设置</span>
            </li>
          </el-col>
          <el-col :span="4" :offset="2">
            #fb7676
            <li @click="guide" style=" ">
              <span><img src="../../assets/redlogo/xiangdao.png" class="imgStyle" alt="" /></span>
              <span>配置向导</span>
            </li>
          </el-col> -->
        </el-row>

        <!--<li @click="shenjirzs">-->
        <!--<span>-->
        <!--<img src="../../assets/images/audit.png" alt="" />-->
        <!--</span>-->
        <!--<span>审计日志</span>-->
        <!--</li>-->
        <!--<li @click="sanheyis">-->
        <!--<span>-->
        <!--<img src="../../assets/images/18关于-下拉框_23.gif" alt="" />-->
        <!--</span>-->
        <!--<span>三合一</span>-->
        <!--</li>-->

      </div>
    </div>
    <div class="box_bottom" @click="openNewWindow">
      <div style="float:left; margin-left:10px;font-family: 微软雅黑;">客户端版本 {{versionNumber}}</div>
      <div style="float:right;margin-right:10px;font-family: 微软雅黑;"> {{temModename}}</div>
    </div>
  </div>
</template>

<script>
import { menuDatasSINGLE, menuDatasONLINE } from "../../assets/js/menudata";
export default {
  name: "home",
  data() {
    return {
      versionNumber: '',
      systemName: window.systemName,
      userName: window.sessionStorage.getItem("userName"),
      menuData: [],
      menuDatas: [],
      routerData: [
        {
          name: "资产管理",
          path: "assetManagement",
          imgUrl: require("../../assets/redlogo/zichan.png"),
        },
        {
          name: "身份鉴别",
          path: "identifications",
          imgUrl: require("../../assets/redlogo/shenfen.png"),
        },
        {
          name: "审计日志",
          path: "clientAudits",
          imgUrl: require("../../assets/redlogo/rizhi.png"),
        },
        {
          name: "日志管理",
          path: "clientAudits",
          imgUrl: require("../../assets/redlogo/rizhi.png"),
        },
        {
          name: "策略管理",
          path: "accessControls",
          imgUrl: require("../../assets/redlogo/celue.png"),
        },
        {
          name: "系统设置",
          path: "systemSetting",
          imgUrl: require("../../assets/redlogo/shezhi.png"),
        },
        {
          name: "配置向导",
          path: "install",
          imgUrl: require("../../assets/redlogo/xiangdao.png"),
        },
      ],
      systemMode: window.systemMode,
      temModename: "",
    };
  },
  created() {
    if (systemMode == "SINGLE") {
      this.temModename = "单机版";
      this.menuData = menuDatasSINGLE[this.userName];
    } else {
      this.temModename = "网络版";
      this.menuData = menuDatasONLINE[this.userName];
    }
    this.$get("/api/v1/getversion").then(res => {
      console.log(res.data)
      this.versionNumber = res.data.version
    })
    console.log(this.menuData);
    this.menudata();
  },
  methods: {
    menudata() {
      let data = [];
      for (let i = 0; i < this.routerData.length; i++) {
        for (let j = 0; j < this.menuData.length; j++) {
          if (this.routerData[i].name === this.menuData[j].menuName) {
            data.push(this.routerData[i]);
          }
        }
      }
      this.menuDatas = data;
    },
    //路由跳转
    goto(route) {
      this.$router.push({
        path: "/" + route,
      });
    },

    // 身份鉴别
    manaGement() {
      this.$router.push({
        path: "/identifications",
      });
    },
    // 审计日志
    shenjirzs() {
      this.$router.push({
        path: "/clientAudits",
      });
    },
    // 三合一
    sanheyis() {
      this.$router.push({
        path: "/assetManagement",
      });
    },
    // 接入控制
    jierukong() {
      this.$router.push({
        path: "/accessControls",
      });
    },
    // 配置向导
    guide() {
      this.$router.push({
        path: "/install",
      });
    },
    // 系统设置
    setting() {
      this.$router.push({
        path: "/systemSetting",
      });
    },
    openNewWindow() {
      console.log("子窗口&图标闪烁");
      // window.electron.ipcRenderer.send("newsWindow"); //子窗口
      // window.electron.ipcRenderer.send("flashisticons"); //图标/任务栏闪烁
    },
  },
};
</script>
